package controller.menubar;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

import model.GlobalParams;
import view.MainFrame;

public class ConfirmDialog implements ActionListener {
	
	public ConfirmDialog(MainFrame f) {
		frame = f;		
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {	
		Boolean s = true;	
		createConfirmDialog(s);
	}	
	
	
	public void createConfirmDialog(Boolean s) {
		
		String confirm_question;			
		confirm_question = GlobalParams.getInstance().stringCollection.getQuit_question();		
		String quit_titlewindow = GlobalParams.getInstance().stringCollection.getQuit_tittle();			
	    int response = JOptionPane.showConfirmDialog(null, confirm_question, quit_titlewindow,
	    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
	    
	    if (response == JOptionPane.YES_OPTION) {
	    	 frame.setVisible(false);
		     frame.dispose();	   
	    }
		
	}
	
	private MainFrame frame;

}